package cn.fzm.ssm.service.impl;

import cn.fzm.ssm.dao.IPermissionDao;
import cn.fzm.ssm.domain.Permission;
import cn.fzm.ssm.service.IPermissionService;
import cn.fzm.ssm.utils.UUIDUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author Dremeue
 * @create 2019-10-13 1:39
 **/
@Service
@Transactional
public class PermissionService implements IPermissionService {

    @Autowired
    private IPermissionDao permissionDao;

    @Override
    public List<Permission> findAll() {
        return permissionDao.findAll();
    }

    @Override
    public void save(Permission permission) {
        permission.setId(UUIDUtils.getUUID());
        permissionDao.save(permission);
    }

    @Override
    public List<Permission> findOtherPermission(String roleId) {
        return permissionDao.findOtherPermission(roleId);
    }
}
